Package edu.uky.ai.lp.logic
Class Variable
java.lang.Object
edu.uky.ai.lp.logic.Term
edu.uky.ai.lp.logic.Variable
- All Implemented Interfaces:
Formula
public class Variable extends Term
Represents a place-holder term which can be bound to any constant.
- Author:
- Stephen G. Ware
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Variable(java.lang.String name)Constructs a new variable with a given name. -
Method Summary
Modifier and Type Method Description Termsubstitute(Unifier unifier)Return a version of this formula with its variables replaced with the values assigned to them by a unifier.Unifierunify(Formula other, Unifier unifier)Unify this formula with another formula, adding to a given unifier as needed to make the two expression the same.
-
Constructor Details
-
Variable
public Variable(java.lang.String name)Constructs a new variable with a given name.- Parameters:
name- the name
-
-
Method Details
-
unify
Description copied from interface:FormulaUnify this formula with another formula, adding to a given unifier as needed to make the two expression the same. The unifier passed in as an argument will not be modified; the (possibly extended) unifier is be returned by this method.- Parameters:
other- the other logical formula to unify withunifier- the unifier to extend- Returns:
- the new unifier that makes the two formulas the same, or null if they cannot unify
-
substitute
Description copied from interface:FormulaReturn a version of this formula with its variables replaced with the values assigned to them by a unifier.- Specified by:
substitutein interfaceFormula- Specified by:
substitutein classTerm- Parameters:
unifier- the unifier- Returns:
- the formula with variables replaced
-